<?php
require_once("conf/db_connection.php");

$trip_id = $_GET["id"];
$return_str = "";

$query_trip = "SELECT * FROM trip_detail WHERE id='".$trip_id."'";
$result_trip = mysql_query($query_trip) or die("SELECT TRIP DETAIL ".mysql_error());
$row_trip = mysql_fetch_array($result_trip);

$opt_source = "";
$query_source = "SELECT * FROM lookup_source WHERE is_deleted='0'";
$result_source = mysql_query($query_source) or die("SELECT SOURCE LIST ".mysql_error());
while($row_source = mysql_fetch_array($result_source))
{
	$opt_source .= "<option value='".$row_source['name']."'>".strtoupper($row_source['name'])."</option>";
}

$opt_qty = "";
$opt_qty .= "<option value='1'>1</option>";
$opt_qty .= "<option value='2'>2</option>";

$opt_size = "";
$opt_size .= "<option value='10'>10FTR</option>";
$opt_size .= "<option value='20'>20FTR</option>";
$opt_size .= "<option value='40'>40FTR</option>";

$opt_class = "";
$opt_class .= "<option value='A'>A</option>";
$opt_class .= "<option value='B'>B</option>";
$opt_class .= "<option value='C'>C</option>";

$ctr=0;
$opt_hour = "";
while($ctr<24)
{
	$hour_val = $ctr<10?"0".$ctr:$ctr;
	$opt_hour .= "<option value='".$hour_val."'>".$hour_val."</option>";
	$ctr++;
}

$ctr=0;
$opt_min = "";
while($ctr<60)
{
	$min_val = $ctr<10?"0".$ctr:$ctr;
	$opt_min .= "<option value='".$min_val."'>".$min_val."</option>";
	$ctr++;
}

$return_str = "<table id='pop_table' class='booking_tbl' border='0' style='margin:25px 25px 0px 25px; padding: 0px auto;width:950px;height:300px;background-color:#FFFFFF;'>
<thead style='height:15%;'>
<tr id='hor-minimalist-b'>
	<th colspan='8'><br />Booking Details</th>
</tr>
</thead>
<tbody>
<tr>
	<td class='label'>Source</td>
	<td class='td_input'><select id='txt_source' name='txt_source'>".$opt_source."</select></td>
	<td class='label'>Booking #</td>
	<td class='td_input'><input id='txt_booking_num' name='txt_booking_num' type='text' /></td>
	<td class='label'>Quantity</td>
	<td class='td_input'><select id='sel_qty' name='sel_qty'>".$opt_qty."</select></td>
	<td class='label'>Size</td>
	<td class='td_input'><select id='sel_size' name='sel_size'>".$opt_size."</td>
</tr>
<tr>
	<td class='label'>Vessel<br />Voyage</td>
	<td class='td_input'><input id='txt_vesvoy' name='txt_vesvoy' type='text' /></td>	
	<td class='label'>Vessel<br />Voyage ETD</td>
	<td class='td_input'><input readonly='readonly' id='txt_vesvoy_etd' name='txt_vesvoy_etd' type='text' value='".$row_trip['positioning_time']."' /></td>
	<td class='label'>Pickup<br />Date</td>
	<td class='td_input'><input readonly='readonly' id='txt_pick_date' name='txt_pick_date' type='text' value='".$row_trip['positioning_time']."' /></td>
	<td class='label'>Pickup<br />Time</td>
	<td class='td_input'>
		<select style='width:auto;' id='sel_pick_hour' name='sel_pick_hour'>".$opt_hour."</select>&nbsp;:&nbsp;
		<select style='width:auto;' id='sel_pick_min' name='sel_pick_min'>".$opt_min."</select>
	</td>
</tr>
<tr>
	<td class='label'>Shipper<br />Name</td>
	<td class='td_input' colspan='3'><input id='txt_shipper' name='txt_shipper' type='text' style='width:98%;' /></td>
	<td class='label'>Shipper<br />Code</td>
	<td class='td_input'><input id='txt_shipper_code' name='txt_shipper_code' type='text' /></td>	
	<td class='label'>Commodity<br />Class</td>
	<td class='td_input'><select id='sel_class' name='sel_class'>".$opt_class."</select></td>
</tr>
<tr>	
	<td class='label'>Pickup<br />Address</td>
	<td class='td_input' colspan='3'><textarea  id='txt_pick_add' name='txt_pick_add' cols='40' rows='1' style='width:98%;'></textarea></td>
	<td class='label'>Contact<br />Person</td>	
	<td class='td_input'><input  id='txt_contact_person' name='txt_contact_person' type='text' /></td>
	<td class='label'>Contact #</td>
	<td class='td_input'><input id='txt_contact_num' name='txt_contact_num' type='text' /></td>	
</tr>
<tr>
	<td class='label'>Special<br />Instructions</td>
	<td class='td_input' colspan='3'><textarea  id='txt_instruction' name='txt_instruction' cols='40' rows='1' style='width:98%;'></textarea></td>
	<td class='label'>Type</td>
	<td class='td_input'><input id='txt_type' name='txt_type' type='text' /></td>	
</tr>
</tbody>
</table>";

$return_str .= "<table id='pop_table' border='0' style='margin:0px 25px 25px 25px; padding: 0px auto;width:950px;height:100px;background-color:#FFFFFF;'>
<thead style='height:2%;'>
<tr id='hor-minimalist-b'>
	<th colspan='8'>&nbsp</th>
</tr>
</thead>
<tbody>
<tr>
	<td style='text-align:center;' colspan='4'>
		<input onClick='confirmBooking()'style='width:auto;' type='button' value='Submit' />&nbsp;&nbsp;&nbsp;
		<input onClick='closePopDiv()' style='width:auto;' type='button' value='Close' />
	</td>
</tr>
</tbody>
</table>
<input id='hf_truck_id' name='hf_truck_id' type='hidden' />
<input id='hf_assign_trip_id' name='hf_assign_trip_id' type='hidden' value='".$trip_id."' />";
echo $return_str;
?>